home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4884 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! Memory Problems
  5. Date: 7 Feb 1996 18:41:47 GMT
  6. Organization: News & Observer Public Access
  7. Message-ID: <4farpb$4h2@castle.nando.net>
  8. References: <4f6f0e$7gg@ntuix.ntu.ac.sg>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail2317.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <4f6f0e$7gg@ntuix.ntu.ac.sg>, chiapl@bbs.sas.ntu.ac.sg (Chia Puay Long) writes:
  14. >Hi,
  15. >
  16. >My program (compiled using Borland C++ 3.1) hangs when I tried to run it.
  17. >The program was running fine before I added two array of 512 unsigned
  18. >character. (using dynamic memory allocation, calloc) I suspected that
  19. >the PC hangs becos of memory problems.
  20. >
  21. >Like to know whether anyone of you has faced such problems? If so,
  22. >what are the solution available?
  23. >(I have tried to compile with various memory model and it doesnt work)
  24.  
  25. If calloc(), malloc() or realloc() fail to allocate the memory requested,
  26. they return NULL.  Always check whether a non-NULL pointer is returned
  27. before continuing.
  28.  
  29. Also, unless you're coding for obsolete 16 bit processors, you should
  30. update your compiler -- BC 3.1 does not support the flat memory model
  31. available on current compilers.
  32.  
  33. Bill McCarthy
  34. actuary@nando.net
  35. Wendell, NC  USA
  36.  
  37.